package com.example.test.享元模式;

import cn.hutool.core.util.RandomUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON;
import com.example.test.bean.User;
import com.sun.media.sound.SoftTuning;

public class main {

    public static void main(String[] args) {


        System.out.println(Integer.parseInt("00"));

        String mail = null;

//        System.out.println(JSONUtil.toJsonStr(mail)==null);


        XYFactory xyFactory = new XYFactory();

        for (int i = 0; i < 100; i++) {
            User user = xyFactory.getUser(RandomUtil.randomInt(9));
            System.out.println(user);
        }


        User user = new User();
        user.setName("123");
        user.setId("112");


        String x1 = JSON.toJSON(user).toString();
        System.out.println(x1);

        User user1 = new User();
        user.setName(x1);

        System.out.println(user1.getName());


        String msg = "{\"name\":\"123\",\"id\":\"112\"}";
        User x = JSONUtil.toBean(JSONUtil.formatJsonStr(msg), User.class);
        System.out.println(x);
        System.out.println(x.getName());

    }
}
